// JavaScript Document
$(document).ready(function() {
	// Countdown Canvas
	var scriptCode = '<script type="text/javascript" src="js/Main.js"> <\/script> <script type="text/javascript" src="js/TimerUtils.js" defer="defer"> <\/script>';
	setTimeout(function(){
		$("body").append(scriptCode);
	},1000); 
	$(':input[placeholder]').placeholder();
		
	
	function contact() {
		if ($("#signup-form").is(":hidden"))
		{
			$("#ribbon").css({"background":"url(image/signup.png) top left no-repeat" });
			$("#ribbon > span.signup").css({"display":"block" });
			$("#ribbon > span.newsletter").css({"display":"none" });
			//$("#ribbon").addClass("active");
			$("#count-dwn").slideUp("fast");
			$("#signup-form").slideDown("slow");
		}
		else{
			//$("#ribbon").removeClass("active");
			$("#ribbon").css({"background":"url(image/mail.png) top left no-repeat"});
			$("#ribbon > span.newsletter").css({"display":"block" });
			$("#ribbon > span.signup").css({"display":"none" });
			//$("#ribbon").css("background","images/mail.png");
			$("#signup-form").slideUp("slow");
			$("#count-dwn").slideDown("slow");
		}
		$(':input[placeholder]').placeholder();
	}
	$(".contact").click(function(){contact()});	
	//eof tabbing
	
	//value focus
	$('input[type="text"] , textarea , input[type="password"] , input[type="email"]').addClass("idleField");
	$('input[type="text"] , textarea , input[type="password"] , input[type="email"]').focus(function() {
		$(this).removeClass("idleField").addClass("focusField");
		if (this.placeholder == this.defaultValue){ 
			this.placeholder = '';
		}
		if(this.placeholder != this.defaultValue){
			this.select();
		}
	});
	$('input[type="text"] , textarea , input[type="password"] , input[type="email"]').blur(function() {
		$(this).removeClass("focusField").addClass("idleField");
		if ($.trim(this.placeholder) == ''){
			this.placeholder = (this.defaultValue ? this.defaultValue : '');
		}
	});
	//eof value focus
	//setting sliding panel
	
	$('button').click(function() {
		var $lefty = $('.inner');
		var $btn = $('button').outerWidth();
		var width = $lefty.outerWidth()-$btn;
		$lefty.animate({
		  left: parseInt($lefty.css('left'),10) == 0 ?
			-width:
			0
		});
	  });
	  
	//eof sliding panel
	
	
	// Change Background
	$(".colorbox").click(function(){
		 $(".colorbox").removeClass('active');
		var style = $(this).attr("rel");
		 $("link[media='screen']").attr("href", style+".css");
		 $(this).addClass('active');
		 return false;
		
	})
	
	
	$('#email').focus(function(){
		var real_value = $(this).defaultValue;
		if ($(this).val()!='')
			$(this).val('');
	});
				
	$('#email').blur(function(){
		var real_value = $(this).defaultValue;
		if ($(this).val()=='')
			$(this).val('enter your email address here.');
	});
		
});

